Try HAML-TO-PHP Online

Pre-defined variables available in this sandbox:
array(
  'title' => 'hello customer!',
  'text'  => 'some content to be quoted <>',
)

For security, only strtoupper and strtolower are allowed in interpolations.

Sample HAML

You can copy and paste samples from the Examples page. Below is a starter example:

%div
  %p Hello customer
  %p=strtoupper($text)
:plain
  You could be writing a letter here
%select
  - foreach(array('r','g') as $c)
    %option{:value=>$c,:selected=>$c=='g'}=$c

HTML Output

Notice that selected=true magically turns into selected='selected'!

<div><p>Hello customer</p><p>SOME CONTENT TO BE QUOTED &lt;&gt;</p></div>
You could be writing a letter here
<select>
  <option value='r'>r</option>
  <option value='g' selected='selected'>g</option>
</select>

Rendered in Your Browser

Hello customer

SOME CONTENT TO BE QUOTED <>

You could be writing a letter here

Generated PHP Code

Note: Creating PHP functions is an option.

function custom_haml(){
  ob_start();
  ob_implicit_flush(false);
  try{
    $args = func_get_args();
    /* put vars in scope: */
    foreach ($args as $arr) { extract($arr); }
    ?>
<div>
<p>Hello customer</p>
<p><?php echo htmlentities(strtoupper($text), ENT_QUOTES, 'utf-8')?></p>
</div>
<?php echo HamlUtilities::plain('utf-8','You could be writing a letter here'."\n")?>
<select>
<?php foreach(array('r','g') as $c){?>
  <option
    <?php echo HamlUtilities::renderAttribute('value',($c),"'", 'utf-8', false)?>
    <?php echo HamlUtilities::renderAttribute('selected',($c=='g'),"'", 'utf-8', false)?>>
    <?php echo htmlentities($c, ENT_QUOTES, 'utf-8')?>
  </option>
<?php }?>
</select>
    <?php
    return ob_get_clean();
  }catch(Exception $e){
    ob_end_clean();
    throw $e;
  }
}

Questions? Contact Support.

Usage Sample